+ Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkwindow.c (gtk_window_show): Disable the
+ focus-some-widget code for GtkPlug descendants.
+
+ * gtk/gtkplug.c (gtk_plug_focus_event): Eat
+ focus-in/out events since they can be generated
+ by keyboard grabs, but are spurious for an embeddded
+ widget. (#79196, Padraig O'Briain)
+
+ * gtk/gtksocket.c (gtk_socket_size_request): Only
+ pay attention to the minimum size hints, and changes
+ to that ... ignore the default size.
+
+ * gtk/gtksocket.c (gtk_socket_send_configure_event):
+ Pass in root-window relative coordinates as per
+ the ICCCM.
+
+ * gtk/gtksocket.c (gtk_socket_size_allocate): Send
+ as many synthetic configures as necessary to make
+ up for ConfigureRequest events we got. (#78799,
+ Dave Camp.)
+
Thu May 16 23:59:56 2002 Kristian Rietveld <kris@gtk.org>
Merged from gtk-2-0.
+ Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkwindow.c (gtk_window_show): Disable the
+ focus-some-widget code for GtkPlug descendants.
+
+ * gtk/gtkplug.c (gtk_plug_focus_event): Eat
+ focus-in/out events since they can be generated
+ by keyboard grabs, but are spurious for an embeddded
+ widget. (#79196, Padraig O'Briain)
+
+ * gtk/gtksocket.c (gtk_socket_size_request): Only
+ pay attention to the minimum size hints, and changes
+ to that ... ignore the default size.
+
+ * gtk/gtksocket.c (gtk_socket_send_configure_event):
+ Pass in root-window relative coordinates as per
+ the ICCCM.
+
+ * gtk/gtksocket.c (gtk_socket_size_allocate): Send
+ as many synthetic configures as necessary to make
+ up for ConfigureRequest events we got. (#78799,
+ Dave Camp.)
+
Thu May 16 23:59:56 2002 Kristian Rietveld <kris@gtk.org>
Merged from gtk-2-0.
+ Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkwindow.c (gtk_window_show): Disable the
+ focus-some-widget code for GtkPlug descendants.
+
+ * gtk/gtkplug.c (gtk_plug_focus_event): Eat
+ focus-in/out events since they can be generated
+ by keyboard grabs, but are spurious for an embeddded
+ widget. (#79196, Padraig O'Briain)
+
+ * gtk/gtksocket.c (gtk_socket_size_request): Only
+ pay attention to the minimum size hints, and changes
+ to that ... ignore the default size.
+
+ * gtk/gtksocket.c (gtk_socket_send_configure_event):
+ Pass in root-window relative coordinates as per
+ the ICCCM.
+
+ * gtk/gtksocket.c (gtk_socket_size_allocate): Send
+ as many synthetic configures as necessary to make
+ up for ConfigureRequest events we got. (#78799,
+ Dave Camp.)
+
Thu May 16 23:59:56 2002 Kristian Rietveld <kris@gtk.org>
Merged from gtk-2-0.
+ Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkwindow.c (gtk_window_show): Disable the
+ focus-some-widget code for GtkPlug descendants.
+
+ * gtk/gtkplug.c (gtk_plug_focus_event): Eat
+ focus-in/out events since they can be generated
+ by keyboard grabs, but are spurious for an embeddded
+ widget. (#79196, Padraig O'Briain)
+
+ * gtk/gtksocket.c (gtk_socket_size_request): Only
+ pay attention to the minimum size hints, and changes
+ to that ... ignore the default size.
+
+ * gtk/gtksocket.c (gtk_socket_send_configure_event):
+ Pass in root-window relative coordinates as per
+ the ICCCM.
+
+ * gtk/gtksocket.c (gtk_socket_size_allocate): Send
+ as many synthetic configures as necessary to make
+ up for ConfigureRequest events we got. (#78799,
+ Dave Camp.)
+
Thu May 16 23:59:56 2002 Kristian Rietveld <kris@gtk.org>
Merged from gtk-2-0.
+ Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkwindow.c (gtk_window_show): Disable the
+ focus-some-widget code for GtkPlug descendants.
+
+ * gtk/gtkplug.c (gtk_plug_focus_event): Eat
+ focus-in/out events since they can be generated
+ by keyboard grabs, but are spurious for an embeddded
+ widget. (#79196, Padraig O'Briain)
+
+ * gtk/gtksocket.c (gtk_socket_size_request): Only
+ pay attention to the minimum size hints, and changes
+ to that ... ignore the default size.
+
+ * gtk/gtksocket.c (gtk_socket_send_configure_event):
+ Pass in root-window relative coordinates as per
+ the ICCCM.
+
+ * gtk/gtksocket.c (gtk_socket_size_allocate): Send
+ as many synthetic configures as necessary to make
+ up for ConfigureRequest events we got. (#78799,
+ Dave Camp.)
+
Thu May 16 23:59:56 2002 Kristian Rietveld <kris@gtk.org>
Merged from gtk-2-0.
+ Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkwindow.c (gtk_window_show): Disable the
+ focus-some-widget code for GtkPlug descendants.
+
+ * gtk/gtkplug.c (gtk_plug_focus_event): Eat
+ focus-in/out events since they can be generated
+ by keyboard grabs, but are spurious for an embeddded
+ widget. (#79196, Padraig O'Briain)
+
+ * gtk/gtksocket.c (gtk_socket_size_request): Only
+ pay attention to the minimum size hints, and changes
+ to that ... ignore the default size.
+
+ * gtk/gtksocket.c (gtk_socket_send_configure_event):
+ Pass in root-window relative coordinates as per
+ the ICCCM.
+
+ * gtk/gtksocket.c (gtk_socket_size_allocate): Send
+ as many synthetic configures as necessary to make
+ up for ConfigureRequest events we got. (#78799,
+ Dave Camp.)
+
Thu May 16 23:59:56 2002 Kristian Rietveld <kris@gtk.org>
Merged from gtk-2-0.
GtkAllocation *allocation);
static gboolean gtk_plug_key_press_event (GtkWidget *widget,
GdkEventKey *event);
+static gboolean gtk_plug_focus_event (GtkWidget *widget,
+ GdkEventFocus *event);
static void gtk_plug_set_focus (GtkWindow *window,
GtkWidget *focus);
static gboolean gtk_plug_focus (GtkWidget *widget,
widget_class->realize = gtk_plug_realize;
widget_class->unrealize = gtk_plug_unrealize;
widget_class->key_press_event = gtk_plug_key_press_event;
+ widget_class->focus_in_event = gtk_plug_focus_event;
+ widget_class->focus_out_event = gtk_plug_focus_event;
widget_class->show = gtk_plug_show;
widget_class->hide = gtk_plug_hide;
return FALSE;
}
+static gboolean
+gtk_plug_focus_event (GtkWidget *widget,
+ GdkEventFocus *event)
+{
+ /* We eat focus-in events and focus-out events, since they
+ * can be generated by something like a keyboard grab on
+ * a child of the plug.
+ */
+ return FALSE;
+}
+
static void
gtk_plug_set_focus (GtkWindow *window,
GtkWidget *focus)
case XEMBED_FOCUS_OUT:
{
+ GtkWidget *widget = GTK_WIDGET (plug);
GdkEvent event;
event.focus_change.type = GDK_FOCUS_CHANGE;
- event.focus_change.window = GTK_WIDGET (plug)->window;
+ event.focus_change.window = widget->window;
event.focus_change.send_event = TRUE;
- event.focus_change.in = (message == XEMBED_FOCUS_IN);
-
- gtk_widget_event (GTK_WIDGET (plug), &event);
+ if (message == XEMBED_FOCUS_IN)
+ {
+ event.focus_change.in = TRUE;
+ GTK_WIDGET_CLASS (parent_class)->focus_in_event (widget, (GdkEventFocus *)&event);
+ }
+ else
+ {
+ event.focus_change.in = FALSE;
+ GTK_WIDGET_CLASS (parent_class)->focus_out_event (widget, (GdkEventFocus *)&event);
+ }
+
break;
}
#include "xembed.h"
+typedef struct _GtkSocketPrivate GtkSocketPrivate;
+
+struct _GtkSocketPrivate
+{
+ gint resize_count;
+};
+
/* Forward declararations */
static void gtk_socket_class_init (GtkSocketClass *klass);
static GtkWidgetClass *parent_class = NULL;
+GtkSocketPrivate *
+gtk_socket_get_private (GtkSocket *socket)
+{
+ GtkSocketPrivate *private;
+ static GQuark private_quark = 0;
+
+ if (!private_quark)
+ private_quark = g_quark_from_static_string ("gtk-socket-private");
+
+ private = g_object_get_qdata (G_OBJECT (socket), private_quark);
+
+ if (!private)
+ {
+ private = g_new0 (GtkSocketPrivate, 1);
+ g_object_set_qdata_full (G_OBJECT (socket), private_quark,
+ private, (GDestroyNotify) g_free);
+ }
+
+ return private;
+}
+
GtkType
gtk_socket_get_type (void)
{
static void
gtk_socket_end_embedding (GtkSocket *socket)
{
+ GtkSocketPrivate *private = gtk_socket_get_private (socket);
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (socket));
gint i;
g_object_unref (socket->plug_window);
socket->plug_window = NULL;
+ private->resize_count = 0;
/* Remove from end to avoid indexes shifting. This is evil */
for (i = socket->accel_group->n_accels - 1; i >= 0; i--)
long supplied;
gdk_error_trap_push ();
+
+ socket->request_width = 1;
+ socket->request_height = 1;
if (XGetWMNormalHints (GDK_WINDOW_XDISPLAY (socket->plug_window),
GDK_WINDOW_XWINDOW (socket->plug_window),
&hints, &supplied))
{
- /* This is obsolete, according the X docs, but many programs
- * still use it */
- if (hints.flags & (PSize | USSize))
- {
- socket->request_width = hints.width;
- socket->request_height = hints.height;
- }
- else if (hints.flags & PMinSize)
+ if (hints.flags & PMinSize)
{
socket->request_width = hints.min_width;
socket->request_height = hints.min_height;
socket->request_height = hints.base_height;
}
}
- socket->have_size = TRUE; /* don't check again? */
+ socket->have_size = TRUE;
gdk_error_trap_pop ();
}
}
else if (socket->plug_window)
{
+ GtkSocketPrivate *private = gtk_socket_get_private (socket);
+
gdk_error_trap_push ();
- if (!socket->need_map &&
- (allocation->width == socket->current_width) &&
- (allocation->height == socket->current_height))
- {
- gtk_socket_send_configure_event (socket);
- GTK_NOTE(PLUGSOCKET,
- g_message ("GtkSocket - allocated no change: %d %d",
- allocation->width, allocation->height));
- }
- else
+ if (allocation->width != socket->current_width ||
+ allocation->height != socket->current_height)
{
gdk_window_move_resize (socket->plug_window,
0, 0,
allocation->width, allocation->height);
+ if (private->resize_count)
+ private->resize_count--;
+
GTK_NOTE(PLUGSOCKET,
g_message ("GtkSocket - allocated: %d %d",
allocation->width, allocation->height));
socket->need_map = FALSE;
}
+ while (private->resize_count)
+ {
+ gtk_socket_send_configure_event (socket);
+ private->resize_count--;
+ GTK_NOTE(PLUGSOCKET,
+ g_message ("GtkSocket - sending synthetic configure: %d %d",
+ allocation->width, allocation->height));
+ }
+
gdk_display_sync (gtk_widget_get_display (widget));
gdk_error_trap_pop ();
}
gtk_socket_send_configure_event (GtkSocket *socket)
{
XEvent event;
+ gint x, y;
g_return_if_fail (socket->plug_window != NULL);
event.xconfigure.event = GDK_WINDOW_XWINDOW (socket->plug_window);
event.xconfigure.window = GDK_WINDOW_XWINDOW (socket->plug_window);
- event.xconfigure.x = 0;
- event.xconfigure.y = 0;
+ /* The ICCCM says that synthetic events should have root relative
+ * coordinates. We still aren't really ICCCM compliant, since
+ * we don't send events when the real toplevel is moved.
+ */
+ gdk_error_trap_push ();
+ gdk_window_get_origin (socket->plug_window, &x, &y);
+ gdk_error_trap_pop ();
+
+ event.xconfigure.x = x;
+ event.xconfigure.y = y;
event.xconfigure.width = GTK_WIDGET(socket)->allocation.width;
event.xconfigure.height = GTK_WIDGET(socket)->allocation.height;
if (socket->plug_window)
{
- socket->request_width = xcwe->width;
- socket->request_height = xcwe->height;
- socket->have_size = TRUE;
-
GTK_NOTE(PLUGSOCKET,
- g_message ("GtkSocket - window created with size: %d %d",
- socket->request_width,
- socket->request_height));
+ g_message ("GtkSocket - window created"));
}
}
if (socket->plug_window)
{
+ GtkSocketPrivate *private = gtk_socket_get_private (socket);
+
if (xcre->value_mask & (CWWidth | CWHeight))
{
- socket->request_width = xcre->width;
- socket->request_height = xcre->height;
- socket->have_size = TRUE;
-
GTK_NOTE(PLUGSOCKET,
g_message ("GtkSocket - configure request: %d %d",
socket->request_width,
socket->request_height));
-
+
+ private->resize_count++;
gtk_widget_queue_resize (widget);
}
else if (xcre->value_mask & (CWX | CWY))
{
GdkDragProtocol protocol;
- if ((xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "XdndAware")) ||
+ if (xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "WM_NORMAL_HINTS"))
+ {
+ socket->have_size = FALSE;
+ gtk_widget_queue_resize (widget);
+ }
+ else if ((xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "XdndAware")) ||
(xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "_MOTIF_DRAG_RECEIVER_INFO")))
{
gdk_error_trap_push ();
#include "gtkiconfactory.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
+#include "gtkplug.h"
enum {
SET_FOCUS,
/* Try to make sure that we have some focused widget
*/
- if (!window->focus_widget)
+ if (!window->focus_widget && !GTK_IS_PLUG (window))
gtk_window_move_focus (window, GTK_DIR_TAB_FORWARD);
if (window->modal)